<?php
	require_once($_SERVER["DOCUMENT_ROOT"]."/global.php");
	require_once($_SERVER["DOCUMENT_ROOT"]."/modules/security_mod.php");
	require_once($_SERVER["DOCUMENT_ROOT"]."/alerter/modules/account_mod.php");
	require_once($_SERVER["DOCUMENT_ROOT"]."/alerter/modules/alert_mod.php");

	SecurityMod::login();

	$level = $_SESSION["account"]->getLevel();
	if ($level != "Admin" && $_SESSION["account"]->getAdvanced() == 0 && $_SESSION["account"]->getSecret() == 0)
		SecurityMod::logout();

	$alertAccount = AlertAccountMod::getAccount($_SESSION["account"]->getName());
	
	AlertMod::addManualAlert(
		new ManualAlert(
			v($_REQUEST, "alerter"),
			v($_REQUEST, "alertType"),
			v($_REQUEST, "sector"),
			v($_REQUEST, "coords"),
			v($_REQUEST, "header"),
			v($_REQUEST, "details")
		)
	);
	
	header('location: alerts.php');

?>